var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/test', function(req, res, next) {
  console.log(req.query);
  res.json({err:0,msg:"试试行不行",data:avat});
});
router.post('/test', function(req, res, next) {
  console.log(req.body);
  res.json({err:0,msg:"试试行不行"});
});

var svgCaptcha = require('svg-captcha');
 
router.get('/captcha', function (req, res) {
    var captcha = svgCaptcha.create();
    req.session.captcha = captcha.text;
    res.type('svg');
    res.status(200).send(captcha.data);
});



module.exports = router;
var avat = [
  "/img/avatar/1.jpg",
  "/img/avatar/2.jpg",
  "/img/avatar/3.jpg",
]